package com.qf.administration.controller;

import com.github.pagehelper.PageInfo;
import com.qf.administration.qo.SortQO;
import com.qf.administration.service.SortService;
import com.qf.administration.vo.SortVO;
import com.qf.common.base.result.RespResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Title: SortController
 * @Description:
 * @author:ZWX
 * @date: 2023/5/23 15:54
 */
@Api(tags = "会议类别管理")
@RestController
@RequestMapping("/sort")
public class SortController {
    @Resource
    private SortService sortService;

    @ApiOperation("添加会议类别信息")
    @PostMapping("/add")
    @ApiResponses({@ApiResponse(code = 200, message = "成功")})
    public RespResult<String> addSort(@RequestBody SortQO sortQO) {
        return sortService.addSort(sortQO);
    }

    @ApiOperation("伪删除会议类别信息")
    @PostMapping("/delete")
    @ApiResponses({@ApiResponse(code = 200, message = "成功")})
    public RespResult<String> deleteSort(@RequestParam int[] ids) {
        return null;
    }

    @ApiOperation("修改会议类别信息")
    @PutMapping("/update")
    public RespResult<String> updateSort(@RequestBody SortQO sortQO) {
        return sortService.updateSort(sortQO);
    }

    @ApiOperation("查询会议类别信息")
    @GetMapping("/list")
    public RespResult<PageInfo<SortVO>> querySort(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size, @RequestParam String sortName) {
        return RespResult.success(sortService.querySort(page, size, sortName));
    }

    @ApiOperation("查询会议类别单条信息")
    @GetMapping("/one")
    public SortVO querySortOne(@RequestParam int sortId) {
        return sortService.querySortOne(sortId);
    }
}
